package com.yhgarden.bbs.controller.thirdPartApi;

import com.yhgarden.bbs.model.response.BaseResponse;
import com.yhgarden.bbs.service.api.thirdPartApi.AliyunAreasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = {"/thirdPartApi/aliyunAreas","*/thirdPartApi/aliyunAreas"})
public class AliyunAreasController {

    @Autowired
    private AliyunAreasService aliyunAreasService;

    @RequestMapping(value = "/getProvinces", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getProvinces() {
        BaseResponse res = aliyunAreasService.getProvinces();
        return res;
    }

    @RequestMapping(value = "/getCities/{adcode}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getCities(@PathVariable("adcode") String adcode) {
        BaseResponse res = aliyunAreasService.getCities(adcode);
        return res;
    }

    @RequestMapping(value = "/getDistricts/{adcode}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getDistricts(@PathVariable("adcode") String adcode) {
        BaseResponse res = aliyunAreasService.getDistricts(adcode);
        return res;
    }

}
